<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="pro_produce" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 项目搜索 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目管理岗位" prop="person_name">
              {{pro_produce.person_name}}
              <el-button @click="popPostSelection('person_name','process_user')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="项目名称" prop="process_name">
              <el-input v-model="pro_produce.process_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="项目编号" prop="process_num">
              <el-input v-model="pro_produce.process_num" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目描述" prop="process_des">
              <el-input type="textarea" v-model="pro_produce.process_des" ttparea=350></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目性质" prop="nature_name">
              {{pro_produce.nature_name}}
              <el-button @click="popProductProNatureChoice('nature_name','process_nature')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="项目类型" prop="">
              {{pro_produce.process_type}}
              <el-button @click="popProductProTypeChoice('','process_type')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>搜索</el-button>
      <el-button @click="gotoPage('/mes/product/ProcedureSearch?'+vueparams+'')" type='primary' size="mini">清除</el-button>
    </el-form>
    <el-dialog :visible.sync="PostSelectionVisible" append-to-body>
      <PostSelection v-if="PostSelectionVisible" ref="PostSelection" :popparams="popparams"> </PostSelection>
    </el-dialog>
    <el-dialog :visible.sync="ProductProNatureChoiceVisible" append-to-body>
      <ProductProNatureChoice v-if="ProductProNatureChoiceVisible" ref="ProductProNatureChoice" :popparams="popparams"> </ProductProNatureChoice>
    </el-dialog>
    <el-dialog :visible.sync="ProductProTypeChoiceVisible" append-to-body>
      <ProductProTypeChoice v-if="ProductProTypeChoiceVisible" ref="ProductProTypeChoice" :popparams="popparams"> </ProductProTypeChoice>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import PostSelection from "@/views/mes/product/PostSelection";
  import ProductProNatureChoice from "@/views/mes/product/ProductProNatureChoice";
  import ProductProTypeChoice from "@/views/mes/product/ProductProTypeChoice";
  export default {
    name: 'ProcedureSearch',
    components: {
      PostSelection,
      ProductProNatureChoice,
      ProductProTypeChoice,
    },
    props: ['popparams'],
    data() {
      return {
        PostSelectionVisible: false,
        PostSelectionValue: null,
        PostSelectionDesc: null,
        ProductProNatureChoiceVisible: false,
        ProductProNatureChoiceValue: null,
        ProductProNatureChoiceDesc: null,
        ProductProTypeChoiceVisible: false,
        ProductProTypeChoiceValue: null,
        ProductProTypeChoiceDesc: null,
        vueparams: this.getVUEParams(""),
        pro_produce: {
          person_name: null,
          process_name: null,
          process_num: null,
          process_des: null,
          nature_name: null,
          process_type: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/ProcedureAction/procedureSearch?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popPostSelection(desc, value) {
        this.PostSelectionVisible = true;
        this.PostSelectionDesc = desc;
        this.PostSelectionValue = value;
      },
      closePostSelection(value, desc) {
        this.PostSelectionVisible = false;
        this.$set(this.pro_produce, this.PostSelectionDesc, desc);
        this.$set(this.pro_produce, this.PostSelectionValue, value);
      },
      popProductProNatureChoice(desc, value) {
        this.ProductProNatureChoiceVisible = true;
        this.ProductProNatureChoiceDesc = desc;
        this.ProductProNatureChoiceValue = value;
      },
      closeProductProNatureChoice(value, desc) {
        this.ProductProNatureChoiceVisible = false;
        this.$set(this.pro_produce, this.ProductProNatureChoiceDesc, desc);
        this.$set(this.pro_produce, this.ProductProNatureChoiceValue, value);
      },
      popProductProTypeChoice(desc, value) {
        this.ProductProTypeChoiceVisible = true;
        this.ProductProTypeChoiceDesc = desc;
        this.ProductProTypeChoiceValue = value;
      },
      closeProductProTypeChoice(value, desc) {
        this.ProductProTypeChoiceVisible = false;
        this.$set(this.pro_produce, this.ProductProTypeChoiceDesc, desc);
        this.$set(this.pro_produce, this.ProductProTypeChoiceValue, value);
      },
    },
  }
</script>
